@extends('admin_system.layout.layout')

@section('content')
    <br>
    <div class="container-fluid">
        <div class="list-group">
            <a href="#" class="list-group-item active">
                <h4 class="list-group-item-heading">学习官中心</h4>
                <p class="list-group-item-text">通知列表</p>
            </a>
        </div>
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>ID</th>
                <th>类型</th>
                <th>通知标题</th>
                <th>通知内容的ID</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            @foreach($notice as $k=>$v)
                <tr>
                    <td>{{$v->id}}</td>
                    <td>{{$v->type}}</td>
                    <td style="max-width: 150px;">{{$v->title}}</td>
                    <td>{{$v->notice_id}}</td>
                    <td style="max-width: 40px;">
                        <div class="btn-group" style="width: 100%">
                            <button type="button" class="btn btn-danger">
                                <a href="{{route('notice_del',['id'=>$v->id])}}">删除</a>
                            </button>
                            <button type="button" class="btn btn-info">
                                <a href="{{route('notice_show',['id'=>$v->id])}}">编辑</a>
                            </button>
                        </div>
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
        <div class="btn-group col-md-3" style="padding: 0">
            <button type="button" class="btn btn-danger notice_add" style="width: 100%">新增</button>
            @include('admin_system.studyCenter.noticeModal')
        </div>
    </div>
    <script>
        @if(session('notice_success'))
        swal("Oops!", "{{session('notice_success')}}!", "success")
        @elseif(session('notice_errors'))
        swal("Oops!", "{{session('notice_errors')}}!", "error")
        @endif
        @if(session()->has('is_show'))
        $('#modal-notice').modal('show');
        @endif


        $(function () {
            $('.notice_add').on('click', function () {
                $('#modal-notice').modal('show');
            })
        })
    </script>
@endsection

